﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using QLTV_Public;

namespace QLTV_Data
{
  public  class NhomNguoiDung_Data
    {
      KetNoiCSDL_Data kn = new KetNoiCSDL_Data();
      public DataTable layDuLieu()
      {
          return kn.LayDuLieu("Load_tbl_NhomQuyen");
      }
      public DataTable TaoBang(string sql)
      {
          return kn.taobang(sql);
      }
      public int Insert_NhomNguoiDung(NhomNguoiDung_Public tenNhom,NhomNguoiDung_Public maQuyen,NhomNguoiDung_Public ghiChu)
      {
          int nparameter = 3;
          string[]name=new string[nparameter];
          object[] value = new object[nparameter];
          name[0] = "@TenNhom";
          value[0] = tenNhom.TenNhom;
          name[1] = "@MaQuyen";
          value[1] = maQuyen.MaQuyen;
          name[2] = "@GhiChu";
          value[2] = ghiChu.GhiChu1;
          return kn.update("Insert_NhomQuyen",name,value,nparameter);
      }
      public int Update_NhomNguoiDung(NhomNguoiDung_Public maNhom,NhomNguoiDung_Public tenNhom, NhomNguoiDung_Public maQuyen, NhomNguoiDung_Public ghiChu)
      {
          int nparameter = 4;
          string[] name = new string[nparameter];
          object[] value = new object[nparameter];
          name[0] = "@MaNhom";
          value[0] = maNhom.MaNhom;
          name[1] = "@TenNhom";
          value[1] = tenNhom.TenNhom;
          name[2] = "@MaQuyen";
          value[2] = maQuyen.MaQuyen;
          name[3] = "@GhiChu";
          value[3] = ghiChu.GhiChu1;
          return kn.update("Update_NhomQuyen", name, value, nparameter);
      }
      public int Delete_NhomNguoiDung(NhomNguoiDung_Public maNhom)
      {
          int nparameter = 1;
          string[] name = new string[nparameter];
          object[] value = new object[nparameter];
          name[0] = "@MaNhom";
          value[0] = maNhom.MaNhom;
          return kn.update("Delete_NhomQuyen", name, value, nparameter);
      }
    }
}
